﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using Croupier_iteration_1.Model;
using Croupier_iteration_1.Model.Jeu;
using System.Collections.Generic;

namespace Croupier_iteration_1.ViewModel
{
    public class MainViewModel : AbstractViewModel
    {
        public Main Main { get; private set; }
        public ObservableCollection<CarteViewModel> CartesVM { get; private set; }
        public int Total {
            get { return this.Main.getTotal(); }
        }

        
        public MainViewModel(Main main)
        {
            this.Main = main;
            this.CartesVM = new ObservableCollection<CarteViewModel>();
            this.Main.Cartes = new List<Carte>();
        }

        public void addCarte(Carte prmCarte)
        {
            this.CartesVM.Add(new CarteViewModel(prmCarte));
            this.Main.Cartes.Add(prmCarte);
            OnPropertyChanged("CartesVM");
            OnPropertyChanged("Total");
        }

        public void ViderMain()
        {
            this.CartesVM.Clear();
            this.Main.Cartes.Clear();
            OnPropertyChanged("CartesVM");
            OnPropertyChanged("Total");
        }

       
    }

}
